﻿#ifndef UTILITIES_H
#define UTILITIES_H

#include <random>
#include <vector>
#include <utility>

#include <vsg/maths/vec3.h>
#include <vsg/maths/color.h>

struct Polar3D
{
    double length;
    double alpha;
    double beta;
};

vsg::vec4 ColorFromHSV(double hue, double saturation, double value);

vsg::dvec3 ColorToHSV(vsg::vec4 color);

vsg::dvec3 Polar3DToXYZRandom(Polar3D polar);

vsg::dvec3 Polar3DToXYZ(Polar3D polar);

std::pair<vsg::dvec3, vsg::dvec3> getOtherNormal(vsg::dvec3 normal);

// 获取给定圆心、半径、点数的同z平面圆
std::vector<vsg::dvec3> genCirclePos(vsg::dvec3 center, double radius, uint8_t posCount);

// 获取给定任意法向量以及圆心、半径的圆离散点
std::vector<vsg::dvec3> getNormalCirclePos(vsg::dvec3 circlePos, double radius, vsg::dvec3 normal, double startAngle, double endAngle, uint8_t pointCount);

std::vector<vsg::dvec3> getNormalConePos(vsg::dvec3 circlePos, vsg::dvec3 normal, double radius);

vsg::dvec3 getRandomNormal(double startAlpha, double endAlpha, double startBeta, double endBeta);

vsg::vec4 getRandomColor();

std::vector<vsg::dvec3> getBallPos(vsg::dvec3 ballPos, double radius, uint8_t alphaCount, uint8_t betaCount);

std::vector<vsg::dvec3> getHeartPos(vsg::dvec3 heartPos, vsg::dvec3 normal, double radius, uint8_t pointCount);

std::vector<vsg::dvec3> getRosebushPos(vsg::dvec3 rosebushPos, vsg::dvec3 normal, double radius, uint8_t bushCount);

bool isToDo(double iterRatio);

#endif
